package com.yosaa.back.enums;

public enum FemaleSitReachScore {
    EXCELLENT_100(100, 25.8f, 26.3f),
    EXCELLENT_95(95, 24.0f, 24.4f),
    EXCELLENT_90(90, 22.2f, 22.4f),
    GOOD_85(85, 20.6f, 21.0f),
    GOOD_80(80, 19.0f, 19.5f),
    PASS_78(78, 17.7f, 18.2f),
    PASS_76(76, 16.4f, 16.9f),
    PASS_74(74, 15.1f, 15.6f),
    PASS_72(72, 13.8f, 14.3f),
    PASS_70(70, 12.5f, 13.0f),
    PASS_68(68, 11.2f, 11.7f),
    PASS_66(66, 9.9f, 10.4f),
    PASS_64(64, 8.6f, 9.1f),
    PASS_62(62, 7.3f, 7.8f),
    PASS_60(60, 6.0f, 6.5f),
    FAIL_50(50, 5.2f, 5.7f),
    FAIL_40(40, 4.4f, 4.9f),
    FAIL_30(30, 3.6f, 4.1f),
    FAIL_20(20, 2.8f, 3.3f),
    FAIL_10(10, 2.0f, 2.5f);

    private final float score;
    private final float freshmanSophomore; // 大一大二标准
    private final float juniorSenior; // 大三大四标准

    FemaleSitReachScore(float score, float freshmanSophomore, float juniorSenior) {
        this.score = score;
        this.freshmanSophomore = freshmanSophomore;
        this.juniorSenior = juniorSenior;
    }

    public float getScore() {
        return score;
    }

    public float getFreshmanSophomore() {
        return freshmanSophomore;
    }

    public float getJuniorSenior() {
        return juniorSenior;
    }

    // 根据成绩和年级计算分数
    public static float calculateScore(float distance, String grade) {
        for (FemaleSitReachScore standard : FemaleSitReachScore.values()) {
            float threshold = grade.equals("大一") || grade.equals("大二")
                    ? standard.getFreshmanSophomore()
                    : standard.getJuniorSenior();
            if (distance >= threshold) {
                return standard.getScore();
            }
        }
        return 0; // 默认分数
    }
}